#ifndef BSP_ARCH_AARCH64_CACHE_H
#define BSP_ARCH_AARCH64_CACHE_H

#include "ft_types.h"

/**************************************************************
 *
 * 		MMU Define
 *
 * *************************************************************/

/* Memory type */
#define NORM_NONCACHE 0x401  /* normal non-cacheable */
#define STRONG_ORDERED 0x409 /* stronly ordered (Device-nGnRnE) */
#define DEVICE_MEMORY 0x40D  /* device memory (Device-nGnRE) */
#define RESERVED 0X00        /* reserved memory */

/* normal write-through cacheable inner shareable */
#define NORM_WT_CACHE 0x711

/* normal write back cacheable inner-shareable */
#define NORM_WB_CACHE 0x705

/*
 *  shareability arrtibute only applicable to
 *  normal cacheable memory
 */
#define INNER_SHAREABLE (0x3 << 8)
#define OUTER_SHAREABLE (0x2 << 8)
#define NON_SHAREABLE (~(0x3 << 8))

/* execution type */
#define EXECUTE_NEVER ((0x1 << 53) | (0x1 << 54))

/* secure type */
#define NON_SECURE (0x1 << 5)

/**************************************************************
 *
 * 		Cache Define
 *
 * *************************************************************/

/************************** Function Prototypes ******************************/
void FCacheDCacheEnable(void);
void FCacheDCacheDisable(void);
void FCacheDCacheInvalidate(void);
void FCacheDCacheInvalidateRange(uintptr adr, u32 len);
void FCacheDCacheFlush(void);
void FCacheDCacheFlushRange(uintptr adr, u32 len);

void FCacheICacheEnable(void);
void FCacheICacheDisable(void);
void FCacheICacheInvalidate(void);

#endif